import req from '@/utils/request'

export interface LoginData {
  username: string
  password: string
}

export interface UserInfo {
  username: string
  token: string
  roles?: string[]
}

export function login(data: LoginData): Promise<UserInfo> {
  return req.post('/login', data)
}
